{extend name="public/base" /}
{block name="main"}
<article class="page-container">
    <form class="form form-horizontal" id="form-rule-add" method="post" action="<?php url('rule/ruleAdd')?>">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>咨询内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <?php echo $result['one']['content']?>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">咨询分类：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:150px;">
		<select class="select" name="category_id" size="1">
            <?php foreach($result['parent_rule'] as $v){?>
                <option value="<?php echo $v['id']?>" <?php echo $result['one']['p_id'] == $v['id']?'selected':''?>><?php echo $v['name']?></option>
            <?php } ?>
		</select>
		</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>审核结果：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="is_checked" type="radio" id="sex-1" checked value="2">
                    <label for="sex-1">审核通过</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="sex-2" name="is_checked" value="3">
                    <label for="sex-2">审核不通过</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" name="id" value="<?php echo $result['one']['id']?>">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}
{block name="js"}
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-yellow',
            increaseArea: '20%'
        });
        $("#form-rule-add").validate({
            rules:{
                title:{
                    required:true,
                },
                status:{
                    required:true,
                },

            },
            submitHandler:function(form){
                /**
                 * 成功之后的回调函数
                 * @type {{success: options.success}}
                 */
                var options = {
                    success: function (data) {
                        if(data.code==10000){
                            layer.msg(data.msg,{icon:1,time:1000});
                            setInterval("closeWindow()",1000);
                        }else{
                            layer.msg(data.msg,{icon:5,time:1000});
                        }
                    }
                };
                $(form).ajaxSubmit(options);
            }
        });
    });
    function closeWindow(){
        var index = parent.layer.getFrameIndex(window.name);
        window.parent.location.reload();
    }
</script>
{/block}
